/*
 * @Author: liyin 2179253556@qq.com
 * @Date: 2023-03-07 16:16:18
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2025-05-06 08:55:15
 * @FilePath: index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: 'HomeView'
  },
  {
    path: '/HomeView',
    name: 'HomeView',
    meta: {
      title: '首页',
      keetAlive: false
    },
    component: () => import('@/views/index.vue')
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior() {
    // 始终滚动到顶部
    return { top: 0 }
  }
})
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title as any
  }
  next()
})
export default router
